// 将万以上的数字转化
export function handleNum(num) {
  if (num > 10000) {
    num = (num / 10000).toFixed(1);
    return num + "万";
  } else {
    return num;
  }
}
// 对音乐时间的转化
export function handleMusicTime(time) {
  time = Math.floor(time / 1000);
  let m = Math.floor(time / 60);
  let s = Math.floor(time % 60);
  m = m < 10 ? "0" + m : m;
  s = s < 10 ? "0" + s : s;

  return m + ":" + s;
}
// 时间格式的转化
export function dateformat(val) {
  const dt = new Date(val);
  const y = dt.getFullYear();
  const m = dt.getMonth() + 1;
  const d = dt.getDate();

  return y + "-" + m + "-" + d;
}
// 补0操作
export function padLeftZero(str) {
  // str=4 -> 004 截取 1 位 -> 04
  return ("00" + str).substr(str.length);
}
// 将分钟转化为毫秒
export function handleSecond(value) {
  let m = value.split(":")[0];
  let s = value.split(":")[1];
  let second = ~~m * 60 + ~~s;
  let time = second * 1000;
  return time;
}
